<?php
/**
 * Created by PhpStorm.
 * User: edmmss
 * Date: 2019/1/2
 * Time: 09:49
 */

namespace app\modules\observer;


use SplSubject;

class UserObserver implements \SplObserver
{
    private $_changedUsers = [];

    /**
     * className
     *
     * @date   2019/1/2
     * @author edmmss
     * @param SplSubject $subject
     */
    public function update(SplSubject $subject)
    {
        // TODO: Implement update() method.
        $this->_changedUsers[] = clone $subject;
    }

    /**
     * 获取修改的对象
     *
     * @date   2019/1/2
     * @author edmmss
     * @return array
     */
    public function getChangedUsers(): array
    {
        return $this->_changedUsers;
    }
}